/**
 * @see [微信官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-socket.html#wxconnectsocketobject)
 */
export default function connect_socket(url: string, header?: wx.RequestHeader, method?: 'OPTIONS' | 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'TRACE' | 'CONNECT', protocols?: string[]) {
	return new Promise<boolean>((resolve, reject) => {
		wx.connectSocket({
			header,
			method,
			protocols,
			url,
			success() {
				resolve(true);
			},
			fail() {
				reject(false);
			}
		});
	});
}
